scons avr

scons
scons mcu=atega16
mcu = ARGUMENTS.get("mcu","atmega128")

avrbld = Builder(action="avr-gcc -mmcu="+mcu+" $SOURCES -o $TARGET",
                suffix=".elf",
                src_surffix=".c")
avrhex = Builder(action="avr-objcopy -j .text -j .data -O ihex $SOURCES $TARGET",
                suffix=".hex",
                src_surffix=".elf")
    
import os
env = Environment(BUILDERS={"AVRProgram":avrbld,
                            "AVRHex":avrhex},
                    ENV=os.environ)
pro = env.AVRProgram("main","main.c")
he  = env.AVRHex("main",pro)
#env.Depends(he,pro)